<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">

<head>
    <th:block th:include="include :: header('线下测评')" />
    <style type="text/css">
        .main {
            /* border: 1px solid red; */
        }

        .main-item1 {
            margin: 10px auto;

            /* border: 1px solid blue; */
            width: 500px;
        }

        .item-title1 {
            margin-bottom: 20px;
            font-size: 24px;
            font-weight: 600;
            color: #777;
            text-align: center;
        }

        img {
            vertical-align: middle;
        }

        .control-label1 {
            float: left;
            width: 125px;
            text-align: left;
            padding-right: 30px;
            line-height: 40px;

        }

        .form-group1 {
            height: 50px;
        }

        .form-control1 {

            margin-right: 20px;
            width: 180px;
            /* height: 28px; */
            padding: 6px 12px;
            font-size: 14px;
            line-height: 1.42857143;
            color: #555;
            background-color: #fff;
            background-image: none;
            border: 1px solid #ccc;
            border-radius: 4px;
            -webkit-box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%);
            box-shadow: inset 0 1px 1px rgb(0 0 0 / 8%);
            -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
            -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
            transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s
        }
    </style>
</head>

<body class="">
<div class="">
    <form class="">
        <input name="childId" id="childId" type="hidden" th:value="${childId}" />
        <input name="reportId" id="reportId" type="hidden" th:value="${reportId}" />
        <input name="token" id="token" type="hidden" th:value="${token}" />
        <div class="">

            <div class="main-item1">
                <div class="item-title1">
                    <img src="../../../images/cp1.png" alt="">
                    <span>感觉运动能力</span>
                </div>
                <div class="form-group1">
                    <div class="">
                        <label class="  control-label1">前庭平衡</label>
                        <input class="form-control1" type="text" name="VESTIBULAR_BALANCE" id="VESTIBULAR_BALANCE" maxlength="3"
                               onkeyup="value=value.replace(/[^\d]/g,'')">分
                    </div>
                </div>
                <div class="form-group1">

                    <div class="">
                        <label class="  control-label1">本体感</label>
                        <input class="form-control1" type="text" name="ONTOLOGY_FEEL" id="ONTOLOGY_FEEL" maxlength="3"
                               onkeyup="value=value.replace(/[^\d]/g,'')">分
                    </div>
                </div>
                <div class="form-group1">
                    <div class="">
                        <label class="  control-label1">触觉防御能力</label>
                        <input class="form-control1" type="text" name="TACTILE_DEFENSE" id="TACTILE_DEFENSE" maxlength="3"
                               onkeyup="value=value.replace(/[^\d]/g,'')">分
                    </div>
                </div>

            </div>
            <div class="main-item1">
                <div class="item-title1">
                    <img src="../../../images/cp2.png" alt="">
                    <span>听知觉能力</span>
                </div>
                <div class="form-group1">
                    <label class="   control-label1 ">听觉记忆广度</label>
                    <div class="">
                        <select style="width:36%;height: 37px;" class="form-control1" name="AUDITORY_MEMORY_BREADTH"
                                id="AUDITORY_MEMORY_BREADTH">
                            <option value="">请选择</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6">6</option>
                            <option value="7">7</option>
                            <option value="8">8</option>
                            <option value="9">9</option>
                            <option value="10">10</option>
                        </select>位
                    </div>
                </div>
                <div class="form-group1">
                    <label class="   control-label1 ">听觉长时记忆</label>
                    <div class="">
                        <select style="width:36%;height: 37px;" class="form-control1" name="AUDITORY_LONG_MEMORY"
                                id="AUDITORY_LONG_MEMORY">
                            <option value="">请选择</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6">6</option>
                            <option value="7">7</option>
                        </select>位
                    </div>
                </div>
            </div>
            <div class="main-item1">
                <div class="item-title1">
                    <img src="../../../images/cp3.png" alt="">
                    <span>视知觉能力</span>
                </div>
                <div class="form-group1" style="margin-bottom:90px;">
                    <label class="control-label1">视分辨率能力</label>
                    <div class="">
                        <label>划掉</label>
                        <input style="width: 150px;" class="form-control1" type="text" name="VISUAL_DISTINGUISH_CROSSEDOUT_TOTAL"
                               id="VISUAL_DISTINGUISH_CROSSEDOUT_TOTAL" maxlength="3" onkeyup="value=value.replace(/[^\d]/g,'')">个
                        <br />
                        <label>划错</label>
                        <input style="width: 150px;margin-top: 12px" class="form-control1" type="text" name="VISUAL_DISTINGUISH_CROSSEDOUT_NUM"
                               id="VISUAL_DISTINGUISH_CROSSEDOUT_NUM" maxlength="3" onkeyup="value=value.replace(/[^\d]/g,'')">个
                        <br />
                        <!-- <div style="width:50px;float: right;display: inline;"> -->
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <label>漏划</label>

                        <input style="width: 150px;margin-top: 12px" class="form-control1" type="text" name="VISUAL_DISTINGUISH_MISS_NUM"
                               id="VISUAL_DISTINGUISH_MISS_NUM" maxlength="3" onkeyup="value=value.replace(/[^\d]/g,'')">个
                        <!-- </div> -->
                        <br />
                    </div>
                </div>
                <div class="form-group1">
                    <label class="control-label1">视觉广度完成量</label>
                    <div class="">
                        <input class="form-control1" type="text" name="VISUAL_BREADTH" id="VISUAL_BREADTH" maxlength="3"
                               onkeyup="value=value.replace(/[^\d]/g,'')">%
                    </div>
                </div>

                <div class="form-group1">
                    <label class="   control-label1 ">视动统合能力</label>
                    <div class="">
                        <input class="form-control1" type="text" name="VISUAL_BREADTH" id="VISUAL_COMPOSITEZ_ABILITY" maxlength="3"
                               onkeyup="value=value.replace(/[^\d]/g,'')">分
                    </div>
                </div>

                <div class="form-group1">
                    <label class="   control-label1 ">视觉记忆</label>
                    <div class="">
                        <input class="form-control1" type="text" name="VISUAL_BREADTH" id="VISUAL_MEMORY" maxlength="3"
                               onkeyup="value=value.replace(/[^\d]/g,'')">分
                    </div>
                </div>
            </div>
            <div class="main-item1">
                <div class="item-title1">
                    <img src="../../../images/cp4.png" alt="">
                    <span>阅读理解能力</span>
                </div>
                <div class="form-group1">
                    <label class="   control-label1 ">阅读时间</label>
                    <div class="">
                        <input class="form-control1" style="width: 65px;" type="text" name="second" id="second" maxlength="3"
                               onkeyup="value=value.replace(/[^\d]/g,'')">分
                        &nbsp;
                        <input style="width: 70px;" class="form-control1" type="text" name="miao" id="miao" maxlength="3"
                               onkeyup="value=value.replace(/[^\d]/g,'')">秒
                    </div>
                </div>

                <div class="form-group1">
                    <label class="   control-label1 ">阅读字数</label>
                    <div class="">
                        <input class="form-control1" type="text" name="READING_TOTAL" id="READING_TOTAL" maxlength="3"
                               onkeyup="value=value.replace(/[^\d]/g,'')">个
                    </div>
                </div>
                <div class="form-group1">
                    <label class="   control-label1 ">错误</label>
                    <div class="">
                        <input class="form-control1" type="text" name="READING_ERROR_NUM" id="READING_ERROR_NUM" maxlength="3"
                               onkeyup="value=value.replace(/[^\d]/g,'')">个
                    </div>
                </div>

                <div class="form-group1">
                    <label class="   control-label1 ">理解正确</label>
                    <div class="">
                        <select style="width:36%;height: 37px;" class="form-control1" name="READING_CORRECT_NUM"
                                id="READING_CORRECT_NUM">
                            <option value="">请选择</option>
                            <option value="1">1</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                        </select>道
                    </div>
                </div>

                <div class="form-group1">
                    <label class="   control-label1 ">词汇理解</label>
                    <div class="">
                        <input class="form-control1" type="text" name="READING_WORDS_UNDERSTANDING"
                               id="READING_WORDS_UNDERSTANDING" maxlength="3" onkeyup="value=value.replace(/[^\d]/g,'')">分
                    </div>
                </div>
            </div>
            <div class="main-item1">
                <div class="item-title1">
                    <img src="../../../images/cp5.png" alt="">
                    <span>口语表达能力</span>
                </div>
                <div class="form-group1">
                    <label class="   control-label1 ">口语表达能力</label>
                    <div class="">
                        <select style="width:36%;height: 37px;" class="form-control1"
                                name="READING_CORRECT_NUM" id="SPEAKING_SKILLS_SCORE">
                            <option value="">请选择</option>
                            <option value="1">1</option>
                            <option value="2">2</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                        </select>分
                    </div>
                </div>
            </div>
            <div class="main-item1">
                <div class="item-title1">
                    <img src="../../../images/cp6.png" alt="">
                    <span>思维能力</span>
                </div>
                <div class="form-group1">
                    <label class="   control-label1 ">思维分数</label>
                    <div class="">
                        <input class="form-control1" type="text" name="THINKING_SCORE" id="THINKING_SCORE" maxlength="3"
                               onkeyup="value=value.replace(/[^\d]/g,'')">分
                    </div>
                </div>

                <div class="form-group1">
                    <label class="   control-label1 ">百分等级</label>
                    <div class="">
                        <input class="form-control1" type="text" name="THINKING_PERCENTAGE" id="THINKING_PERCENTAGE" maxlength="3"
                               onkeyup="value=value.replace(/[^\d]/g,'')">%
                    </div>
                </div>


                <div class="form-group1">
                    <label class="   control-label1 ">IQ</label>
                    <div class="">
                        <input class="form-control1" type="text" name="THINKING_IQ" id="THINKING_IQ" maxlength="3"
                               onkeyup="value=value.replace(/[^\d]/g,'')">
                    </div>
                </div>
            </div>

            <div class="">
                <div class="col-sm-12 btns" style="margin-left: 39%">
                    <button type="button" style="padding: 10px 33px;margin-right: 15px" class="btn btn-lg btn-primary" onclick="submitHandler()"><i class="fa fa-check"></i>保
                        存
                    </button>
                    <button type="button" style="padding: 10px 33px" class="btn btn-lg btn-danger" onclick="closeItem()"><i
                            class="fa fa-reply-all"></i>关 闭
                    </button>
                </div>
            </div>
        </div>
    </form>
</div>
<th:block th:include="include :: footer" />
<script type="text/javascript">

    $(function () {
        var reportId =$("#reportId").val();
        if(reportId !=undefined && reportId !=''){
            $.ajax({
                url: ctx + "business/learningReport/editReport/" +reportId,
                type: "get",
                processData: false,
                contentType: false,
                success: function (result) {
                    if (result.statusCode == '0000') {
                        console.log(result);
                        result.list.forEach(function (value) {
                            if(value.speciesList.length >0){
                                value.speciesList.forEach(function (item) {
                                    if(item.result !=''){
                                        $("#"+item.speciesKey).val(item.result);
                                        $("#"+item.speciesKey).attr("disabled","disabled");
                                    }
                                })
                            }
                        })
                    }
                }
            })
        }
    });


    function submitHandler() {
        ceping();
    }

    function ceping() {
        var second = $("#second").val();
        var miao = $("#miao").val();
        var READING_TIME = "";
        if (miao == "" && second != "") {
            READING_TIME = (parseInt(second) * 60);
        } else if (second == "" && miao != "") {
            READING_TIME = parseInt(miao);
        } else if (miao == "" && second == "") {
            READING_TIME = "";
        } else {
            READING_TIME = (parseInt(second) * 60) + parseInt(miao);
        }
        var READING_TOTAL = $("#READING_TOTAL").val();
        var VESTIBULAR_BALANCE = $("#VESTIBULAR_BALANCE").val();
        var ONTOLOGY_FEEL = $("#ONTOLOGY_FEEL").val();
        var TACTILE_DEFENSE = $("#TACTILE_DEFENSE").val();
        var AUDITORY_MEMORY_BREADTH = $("#AUDITORY_MEMORY_BREADTH option:selected").val();
        var AUDITORY_LONG_MEMORY = $("#AUDITORY_LONG_MEMORY option:selected").val();
        var VISUAL_DISTINGUISH_CROSSEDOUT_TOTAL = $("#VISUAL_DISTINGUISH_CROSSEDOUT_TOTAL").val();
        var VISUAL_DISTINGUISH_CROSSEDOUT_NUM = $("#VISUAL_DISTINGUISH_CROSSEDOUT_NUM").val();
        var VISUAL_DISTINGUISH_MISS_NUM = $("#VISUAL_DISTINGUISH_MISS_NUM").val();
        var VISUAL_BREADTH = $("#VISUAL_BREADTH").val();
        var VISUAL_COMPOSITEZ_ABILITY = $("#VISUAL_COMPOSITEZ_ABILITY").val();
        var VISUAL_MEMORY = $("#VISUAL_MEMORY").val();
        var THINKING_SCORE = $("#THINKING_SCORE").val();
        var THINKING_PERCENTAGE = $("#THINKING_PERCENTAGE").val();
        var READING_CORRECT_NUM = $("#READING_CORRECT_NUM option:selected").val();
        var READING_ERROR_NUM = $("#READING_ERROR_NUM").val();
        var READING_WORDS_UNDERSTANDING = $("#READING_WORDS_UNDERSTANDING").val();
        var SPEAKING_SKILLS_SCORE = $("#SPEAKING_SKILLS_SCORE option:selected").val();
        var THINKING_IQ = $("#THINKING_IQ").val();
        if (AUDITORY_MEMORY_BREADTH != "" && AUDITORY_LONG_MEMORY != "") {
            var data = {
                childId: $("#childId").val(),
                centerId: window.sessionStorage.curCenter,
                reportId: $("#reportId").val(),
                evaluationSource: 1,
                recordList: [{
                    "projectKey": "FEEL_INTEGRATE",
                    "speciesKey": "VESTIBULAR_BALANCE",
                    "result": VESTIBULAR_BALANCE
                },
                    {
                        "projectKey": "FEEL_INTEGRATE",
                        "speciesKey": "ONTOLOGY_FEEL",
                        "result": ONTOLOGY_FEEL
                    },
                    {
                        "projectKey": "FEEL_INTEGRATE",
                        "speciesKey": "TACTILE_DEFENSE",
                        "result": TACTILE_DEFENSE
                    },
                    {
                        "projectKey": "AUDITORY_PERCEPTION_ABILITY",
                        "speciesKey": "AUDITORY_MEMORY_BREADTH",
                        "result": AUDITORY_MEMORY_BREADTH
                    },
                    {
                        "projectKey": "AUDITORY_PERCEPTION_ABILITY",
                        "speciesKey": "AUDITORY_LONG_MEMORY",
                        "result": AUDITORY_LONG_MEMORY
                    },
                    {
                        "projectKey": "VISUAL_PERCEPTION_ABILITY",
                        "speciesKey": "VISUAL_DISTINGUISH_CROSSEDOUT_TOTAL",
                        "result": VISUAL_DISTINGUISH_CROSSEDOUT_TOTAL
                    },
                    {
                        "projectKey": "VISUAL_PERCEPTION_ABILITY",
                        "speciesKey": "VISUAL_DISTINGUISH_CROSSEDOUT_NUM",
                        "result": VISUAL_DISTINGUISH_CROSSEDOUT_NUM
                    },
                    {
                        "projectKey": "VISUAL_PERCEPTION_ABILITY",
                        "speciesKey": "VISUAL_DISTINGUISH_MISS_NUM",
                        "result": VISUAL_DISTINGUISH_MISS_NUM
                    },
                    {
                        "projectKey": "VISUAL_PERCEPTION_ABILITY",
                        "speciesKey": "VISUAL_BREADTH",
                        "result": VISUAL_BREADTH
                    },
                    {
                        "projectKey": "VISUAL_PERCEPTION_ABILITY",
                        "speciesKey": "VISUAL_BREADTH_IN_MINUTES",
                        "result": "3"
                    },
                    {
                        "projectKey": "VISUAL_PERCEPTION_ABILITY",
                        "speciesKey": "VISUAL_COMPOSITEZ_ABILITY",
                        "result": VISUAL_COMPOSITEZ_ABILITY
                    },
                    {
                        "projectKey": "VISUAL_PERCEPTION_ABILITY",
                        "speciesKey": "VISUAL_MEMORY",
                        "result": VISUAL_MEMORY
                    },
                    {
                        "projectKey": "THINKING_ABILITY",
                        "speciesKey": "THINKING_SCORE",
                        "result": THINKING_SCORE
                    },
                    {
                        "projectKey": "THINKING_ABILITY",
                        "speciesKey": "THINKING_PERCENTAGE",
                        "result": THINKING_PERCENTAGE
                    },
                    {
                        "projectKey": "THINKING_ABILITY",
                        "speciesKey": "THINKING_IQ",
                        "result": THINKING_IQ
                    },
                    {
                        "projectKey": "READING_UNDERSTANDING_ABILITY",
                        "speciesKey": "READING_TIME",
                        "result": READING_TIME
                    },
                    {
                        "projectKey": "READING_UNDERSTANDING_ABILITY",
                        "speciesKey": "READING_TOTAL",
                        "result": READING_TOTAL
                    },
                    {
                        "projectKey": "READING_UNDERSTANDING_ABILITY",
                        "speciesKey": "READING_CORRECT_NUM",
                        "result": READING_CORRECT_NUM
                    },
                    {
                        "projectKey": "READING_UNDERSTANDING_ABILITY",
                        "speciesKey": "READING_ERROR_NUM",
                        "result": READING_ERROR_NUM
                    },
                    {
                        "projectKey": "READING_UNDERSTANDING_ABILITY",
                        "speciesKey": "READING_WORDS_UNDERSTANDING",
                        "result": READING_WORDS_UNDERSTANDING
                    },
                    {
                        "projectKey": "READING_UNDERSTANDING_ABILITY",
                        "speciesKey": "SPEAKING_SKILLS_SCORE",
                        "result": SPEAKING_SKILLS_SCORE
                    }
                ]
            }
            $.ajax({
                url: "https://esapi.jsylvip.com/record/save",
                type: "POST",
                data: JSON.stringify(data),
                dataType: "json", //jsonp数据类型
                contentType: "application/json; charset=utf-8",
                headers: {
                    'token': $("#token").val()
                },
                beforeSend: function () {
                    $.modal.loading("正在处理中，请稍后...");
                },
                success: function (result) {
                    $.modal.closeLoading();
                    if (result.statusCode == '0000' ){
                        $.modal.msgSuccess('测评保存成功');
                    }else{
                        $.modal.alertError(result.msg);
                    }
                }
            })
        } else {
            layer.alert("请完成听记忆的测评,听广度的测评才可提交")
        }
    }
</script>
</body>

</html>